import App from './App'
import Vue from 'vue'
import './uni.promisify.adaptor'

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})

import 'style/global.scss'

import { STATIC_URL, BASE_URL } from '@/common/config.js'

Vue.prototype.BASE_URL = BASE_URL
Vue.prototype.STATIC_URL = STATIC_URL
Vue.prototype.getImageUrl = function (imageName) {
  return `${this.STATIC_URL}/images/${imageName}`
}
Vue.prototype.formatPhone = function (phone) {
  let length = phone.length || 0
  return phone.substr(0, 3) + '****' + phone.substr(length - 4, length)
}

import uView from 'uview-ui'

Vue.use(uView)

import utils from './common/utils.js'

Vue.prototype.$utils = utils

import tabBar from '@/components/tabbar/tabbar.vue'

Vue.component('tabBar', tabBar)

// http拦截器，此为需要加入的内容，如果不是写在common目录，请自行修改引入路径
import httpInterceptor from '@/common/http.interceptor.js'
// 这里需要写在最后，是为了等Vue创建对象完成，引入"app"对象(也即页面的"this"实例)
Vue.use(httpInterceptor, app)

// http接口API集中管理引入部分
import httpApi from '@/common/http.api.js'

Vue.use(httpApi, app)

app.$mount()

uni.$zp = {
  config: {
    'default-page-size': 10,
    'empty-view-text': '空空如也~~'
  }
}
